package com.zyd.blog.core.config;

import com.google.common.collect.Lists;
import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.*;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

import javax.ws.rs.core.SecurityContext;
import java.util.List;

/**
 * @Classname Swagger3Config
 * @Description 访问即可/swagger-ui.html
 * @Date 2021/3/7 21:58
 * @Created by xiaok
 */
@Configuration
public class SwaggerConfig {

    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                // 标题
                .title("KingBlog的API文档")
                // 描述
                .description("使用Knife4j构建API文档")
                // 作者信息
                .contact(new Contact("xioak", "http://localhost:8085/", "xiaok1024@163.com"))
                // 服务网址
                .termsOfServiceUrl("http://localhost:8085/")
                // 版本
                .version("1.0.0")
                .build();
    }


}
